$(function () {
    initLayerDate("#beginUseTime",true);
    initLayerDate("#endUseTime",true);
    queryAjaxCouponCode(1);
    $('body').on('click','#submitCouponCode',function () {
        queryAjaxCouponCode(1);
    });
    $('body').on('click','#back',function () {
        backHistory();
    }).on('click','#downloadExcel',function(){

        exportExecl.init({
                title:"优惠券导出",
                excelUrl: '/admin/op/coupon/downloadExcelOpCouponCodeList',
                type:4,
                valId:$('input[name="couponId"]').val()
            }
        );

    });
});
/**
 * 返回上一页
 */
function backHistory() {
    window.history.go(-1);
}
function queryAjaxCouponCode(pageNo) {
    var params = $("#search-form").serializeJSON();
    params = JSON.stringify(params);
    var obj = {
        url: baseloaction + '/admin/op/coupon/queryOpCouponCodeListPage',//请求URL
        contextId: 'couponCode-list-context',//响应内容页面设置内容ID
        params: params,//请求参数
        pageNo: pageNo,//页码
        pageCall: queryAjaxCouponCode, //分页回调加载数据(点击上下页时调用,该方法也在加载页面完成时调用)
        selectAllId: 'select-all-user', //全选框ID
        callback: function () {//数据加载完成回调

        }
    };
    ajaxGetListData(obj);
}